import { resolve } from "dns";
import config from "@/config/config.js";
import { json } from "stream/consumers";


export default {
	uploadFile(tempFile) {
		return new Promise((resolve, reject) => {
			uni.uploadFile({
				url: config.apiBaseUrl + '/file/upload', 
				filePath: tempFile,
				name: 'file',
				formData: {
					
				},
				success: (uploadFileRes) => {
					console.log("上传头像成功：", uploadFileRes.data);
					resolve(JSON.parse(uploadFileRes.data))
				},
				fail(err) {
					console.log("文件上传错误：", err);
				}
			});
		})
	}
}